﻿using System.Windows.Controls;
using System.Windows.Interactivity;

namespace OpenLightGroup.Common.Interactivity
{
    /// <summary>
    /// When triggered will scroll to the top of the scroll viewer
    /// </summary>
    public class ScrollToTopBehavior
        : TriggerAction<ScrollViewer>
    {

        /// <summary>
        /// Invokes the request to scroll to the top.
        /// </summary>
        /// <param name="parameter"></param>
        protected override void Invoke(object parameter)
        {
            this.AssociatedObject.ScrollToVerticalOffset(0);
        }

    }
}
